﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PagedList<Query>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Pending Compensation
</asp:Content>

<asp:Content ID="ContentHeader" ContentPlaceHolderID="ContentHeader" runat="server">
Pending Compensation
</asp:Content>

<asp:Content ID="javascript" ContentPlaceHolderID="Javascript" runat="server">
    
<script type="text/javascript">
    $(document).ready(function() {});
</script>

</asp:Content>

<asp:Content ID="ContentSubNav" ContentPlaceHolderID="ContentSubNav" runat="server">
    <%--<li class=""><%= Html.ActionLink("Open Enquiries", "Index", "Enquiry")%></li>
    <li class=""><%= Html.ActionLink("Completed Enquiries", "Completed", "Enquiry")%></li>
    <li class=""><%= Html.ActionLink("Create Enquiry", "Create", "Enquiry")%></li>
    <li class="selected"><%= Html.ActionLink("Pending Compensation", "Pending", "Enquiry")%></li>
    <li class=""><%= Html.ActionLink("Approved Compensation", "Approved", "Enquiry")%></li>
    <li class=""><%= Html.ActionLink("Declined Compensation", "Declined", "Enquiry")%></li>--%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<p>Compensation requests requiring approval from <strong><%= Html.Encode(Page.User.Identity.Name) %></strong>.</p>

<div class="clearfix" style="border-bottom:2px solid red;margin:0 0 15px;padding:0 0 15px;">
    <a id="filterBtn">Filter</a>
    <input type="submit" class="clearBtn" value="Clear Filter" onClick="location.href='<%= Url.Action((string)null) %>';return false;">
    <div id="filterContainer">
        <div class="faux_form">
            <% Html.RenderPartial("FilterForm", "filter"); %>   
        </div>
    </div>
</div>

<div id="table" style="display:block;">
        <table>
            <tr>
                <th><%= Html.ColumnHeader("Date Raised", new SortExpression<Query>().SortDesc(x => x.EnquiryDate)) %></th>
                <th><%= Html.ColumnHeader("Name", new SortExpression<Query>().SortAsc(x => x.LastName).SortAsc(x => x.FirstName)) %></th> 
                <th><%= Html.ColumnHeader("Type", new SortExpression<Query>().SortDesc(x => x.QueryTypeId))%></th>
                <th><%= Html.ColumnHeader("Product Category", new SortExpression<Query>().SortDesc(x => x.CategoryId))%></th>
                <th><%= Html.ColumnHeader("Product Name", new SortExpression<Query>().SortDesc(x => x.ProductId))%></th>
                <th><%= Html.ColumnHeader("Priority", new SortExpression<Query>().SortDesc(x => x.Priority))%></th>
                <th><%= Html.ColumnHeader("Amount (£)", new SortExpression<Query>().SortDesc(x => x.Amount))%></th>
                <th>Free Text</th>
                <th></th>
            </tr>
  <% foreach (var query in Model)
     {
         %>
         <tr>
            <td><%= Html.Encode(query.EnquiryDate.ToShortDateString()) %></td>
            <td><%= Html.Encode(query.LastName + (query.FirstName != null ? ", " + query.FirstName : "")) %></td>
            <td><%= Html.Encode(query.QueryType.ToDisplayString()) %></td>
            <td><%= Html.Encode(query.Category != null ? query.Category.Name : "") %></td>
            <td><%= Html.Encode(query.Product != null ? query.Product.Name : "") %></td>
            <td><%= Html.Encode(query.Priority) %></td>
            <td><%= Html.Encode(query.Amount) %></td>
            <td><%= Html.Encode(query.FreeTextArea) %></td>
            <td>
                <%= Html.ActionLink("View Item", "Details", new { id = query.QueryId }, new { title = "View Item", @class = "btn btnView" })%>
                <%= Html.ActionLink("Approve Item", "Approve", new { id = query.QueryId }, new { title = "Approve Item", @class = "btn btnConfirm" })%>
                <%= Html.ActionLink("Decline Item", "Decline", new { id = query.QueryId }, new { title = "Decline Item", @class = "btn btnDecline" })%>
            </td>
         </tr>
         <%
     }
       %>
    </table>
    <%= Html.PagingDiv(Model) %>
</div>
    
 </asp:Content>
